a11y: Compute the label for a GtkATContext
authorEmmanuele Bassi <ebassi@gnome.org>
Fri, 9 Oct 2020 20:23:19 +0000 (21:23 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 12 Oct 2020 15:19:32 +0000 (16:19 +0100)
commit21482e8264b1cb8f5c4fc4a8209a38804f1dd088
treed502f68ebfd03655873cbdaf8d78a7545f5787b4
parent88113956a30cdb546ca71d4901d94de93140f3e2
a11y: Compute the label for a GtkATContext

The ARIA spec defines the mechanism for determining the name of an
accessible element—see Â§4.3 of the WAI-ARIA spec.

We follow the specification as much as it makes sense for GTK to do
so:

 1. if the element is hidden, return an empty string
 1. if the element has a labelled-by relation set, retrieve the
    label of the related element
 2. if the element has a label property set, use the value of
    the property
 3. if neither labelled-by nor label attributes are set, we use
    the role to compute the name:
   - for a `range` role, we return the contents of the value of
     the `value-text` or `value-now` properties
   - for any other role, we return a textual representation of
     the GtkAccessibleRole enumeration value
gtk/gtkatcontext.c
gtk/gtkatcontextprivate.h